const Router = require('koa-router');
const {HealthArticle} = require('../models/knowLedgeDataModels');
const router = new Router({
  prefix:'/api/healthArticle'
})

//获取文章的数据
router.get('/list',async(ctx)=>{ 
  try{
    const healthArticle = await HealthArticle.findAll();
    ctx.body = {
      code:200,
      message:'获取文章数据成功',
      data:healthArticle
    }
  }catch(error){
    ctx.body = {
      code:500,
      message:'获取文章数据失败',
      error:error.message
    }
  }
})

module.exports = router;